#!/usr/bin/env bash

# grugly@sdf

source '../say.sh'

ch="$2"
req="$3"

if [[ $req =~ 'faeroes'|'iceland'|'norge'|'ol'|'sdf'|'vpn'|'vps'|'vps2'|'vps3'|'wm' ]]
then
    msg="$(
        lynx -connect_timeout=5 -dump http://sdf.org/?status |
        grep -m 1 "$req" |
        sed -e 's/^[ \t]*//' | tr -s ' '
    )"
else
    msg="Valid hosts are faeroes, iceland, norge, ol, sdf, vpn, vps, vps2, vps3 and wm."
fi

say "$ch" "$msg"

